#include <bits/stdc++.h>
using namespace std;
#define int long long
char buf[1<<23],*p1=buf,*p2=buf,obuf[1<<23],*O=obuf;
#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
inline int read(){
    int x=0,f=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-') f=-1;ch=getchar();}
    while(isdigit(ch)) x=x*10+(ch^48),ch=getchar();
    return x*f;
}
const int N=1e5+4;
int n,a[N],maxx,minn=1e9;
mt19937 rnd(19920725);
signed main(){
    freopen("trade.in","r",stdin);
    freopen("trade.out","w",stdout);
    n=read();
    for(int i=1;i<=n;i++){
        a[i]=read();
        maxx=max(maxx,a[i]);
        minn=min(minn,a[i]);
    }
    if(maxx==1){
        if(minn==0) cout<<"0\n";
        else cout<<"1\n";   
        return 0;
    }
    cout<<rnd()%998244353;
    return 0;
}